package mycode;

import java.lang.reflect.Method;

import org.netbeans.jemmy.ClassReference;
import org.netbeans.jemmy.operators.JButtonOperator;
import org.netbeans.jemmy.operators.JFrameOperator;
import org.netbeans.jemmy.operators.JTextFieldOperator;
import org.netbeans.jemmy.operators.JTreeOperator;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;

public class OriginalTestPlan {

	private ClassReference application;
	@BeforeSuite
	public void setup() throws ClassNotFoundException {
		application = new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser");
	}
	
	@AfterSuite
	public void teardown() {
		///
	}
	
	@SuppressWarnings("unused")
	@BeforeMethod
	public void startApplication(Method method) throws Exception {
		application.startApplication();
	}
	
	@AfterMethod
	public void closeApplication(){
		//application.
		try {
			Thread.sleep(10000);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	@Test
	public void test(){
		 JFrameOperator mainFrame = new JFrameOperator("GUI Browser");
		 new JButtonOperator(mainFrame, "Reload in").push();
		 JTreeOperator tree = new JTreeOperator(mainFrame);

		 //click in the middle of the tree
		 tree.clickMouse();
		 JTextFieldOperator testField = new JTextFieldOperator(mainFrame);

		 //type new value in the text field
		 testField.clearText();
		 testField.typeText("3");
	}
}
